package com.xuan.mail;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableOpenApi
@EnableSwagger2
@MapperScan("com.xuan.mail.mapper") // 扫描Mapper接口
public class MailApplication {

	public static void main(String[] args) { SpringApplication.run(MailApplication.class, args);}
	@Bean
	public Docket createRestApi(){
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.xuan.mail.controller"))
				.paths(PathSelectors.any())
				.build();
	}
	public ApiInfo apiInfo() {
		return new ApiInfoBuilder()
				.title("利用swagger2构建的电子邮箱管理系统测试网站")
				.description("用restful风格写接口")
				.termsOfServiceUrl("")
				.version("1.0")
				.build();
	}

}
